IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fncGetCodeHyojiJun]') 
											AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[fncGetCodeHyojiJun]

GO

CREATE Function [dbo].[fncGetCodeHyojiJun]
(
    @CD_SYU char(5),
    @CD varchar(8)
)
RETURNS varchar(50)
AS
BEGIN
	RETURN (SELECT HYOJI_JUN from M_CD WHERE CD_SYU = @CD_SYU  AND CD_KB = '2' AND CD = @CD)
END


